import {
  bigFilePost,
  mergeFilePost,
  uploadFile,
  downloadOneFile,
  getPublicUrl,
  listPublicUrl
} from '@/api/fileApi'
const fileFun = {
  namespaced: true,
  state: {
  },
  getters: {},
  mutations: {
  },
  actions: {
    BigFilePost ({ state, commit, dispatch }, params) {
      return new Promise((resolve, reject) => {
        bigFilePost(params).then(res => {
          resolve(res)
        }).catch(error => {
          reject(error)
        })
      })
    },
    MergeFilePost ({ state, commit, dispatch }, params) {
      return new Promise((resolve, reject) => {
        mergeFilePost(params).then(res => {
          resolve(res)
        }).catch(error => {
          reject(error)
        })
      })
    },
    UploadFile ({ state, commit, dispatch }, params) {
      return new Promise((resolve, reject) => {
        uploadFile(params).then(res => {
          resolve(res)
        }).catch(error => {
          reject(error)
        })
      })
    },
    DownloadOneFile ({ state, commit, dispatch }, params) {
      return new Promise((resolve, reject) => {
        downloadOneFile(params).then(res => {
          resolve(res)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetPublicUrl ({ state, commit, dispatch }, params) {
      return new Promise((resolve, reject) => {
        getPublicUrl(params).then(res => {
          resolve(res)
        }).catch(error => {
          reject(error)
        })
      })
    },
    ListPublicUrl ({ state, commit, dispatch }, params) {
      return new Promise((resolve, reject) => {
        listPublicUrl(params).then(res => {
          resolve(res)
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}
export default fileFun
